package com.cinc.mdm.modules.bom.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Description: bom树
 * @Author: jeecg-boot
 * @Date:   2021-10-24
 * @Version: V1.0
 */
@Data
@ApiModel(value="mdm_bomPage对象", description="bom主记录")
public class MdmBomTreePage {

	/** 对应id字段,前端数据树中的key*/
	private String key;

	/** 对应materialDesc字段,前端数据树中的title*/
	private String title;

	/**主键*/
	@ApiModelProperty(value = "主键")
	private String id;
	/**物料ID*/
	@Excel(name = "物料ID", width = 15)
	@ApiModelProperty(value = "物料ID")
	private String materialId;
	/**父物料ID*/
	@Excel(name = "父物料ID", width = 15)
	@ApiModelProperty(value = "父物料ID")
	private String superMaterialId;
	/**物料描述*/
	@Excel(name = "物料描述", width = 15)
	@ApiModelProperty(value = "物料描述")
	private String materialDesc;
	/**物料类型ID*/
	@Dict(dictTable = "mdm_material_type", dicText = "material_type_name", dicCode = "id")
	@Excel(name = "物料类型ID", width = 15, dictTable = "mdm_material_type", dicText = "material_type_name", dicCode = "id")
	@ApiModelProperty(value = "物料类型ID")
	private String materialTypeId;
	/**物料类型编码*/
	@Excel(name = "物料类型编码", width = 15)
	@ApiModelProperty(value = "物料类型编码")
	private String materialTypeCode;
	/**物料来源*/
	@Excel(name = "物料来源", width = 15, dicCode = "mdm_material_source")
	@Dict(dicCode = "mdm_material_source")
	@ApiModelProperty(value = "物料来源")
	private String materialSourceCode;
	/**物料编号*/
	@Excel(name = "物料编号", width = 15)
	@ApiModelProperty(value = "物料编号")
	private String materialCode;
	/**单位*/
	@Excel(name = "单位", width = 15, dictTable = "mdm_unit", dicText = "unit_name", dicCode = "unit_code")
	@Dict(dictTable = "mdm_unit", dicText = "unit_name", dicCode = "unit_code")
	@ApiModelProperty(value = "单位")
	private String materialUnitCode;
	/**规格*/
	@Excel(name = "规格", width = 15)
	@ApiModelProperty(value = "规格")
	private String materialSpec;
	/**材质*/
	@Excel(name = "材质", width = 15)
	@ApiModelProperty(value = "材质")
	private String materialMaterial;
	/**图号*/
	@Excel(name = "图号", width = 15)
	@ApiModelProperty(value = "图号")
	private String materialGraphNo;
	/**工厂*/
	@Excel(name = "工厂", width = 15, dictTable = "mdm_factory", dicText = "factory_name", dicCode = "id")
	@Dict(dictTable = "mdm_factory", dicText = "factory_name", dicCode = "id")
	@ApiModelProperty(value = "工厂")
	private String factory;
	/**版本编号*/
	@Excel(name = "版本编号", width = 15)
	@ApiModelProperty(value = "版本编号")
	private String versionNum;
	/**工位编号*/
	@Excel(name = "工位编号", width = 15)
	@ApiModelProperty(value = "工位编号")
	private String stationNum;
	/**生效日期*/
	@Excel(name = "生效日期", width = 15, format = "yyyy-MM-dd")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@ApiModelProperty(value = "生效日期")
	private Date effectiveDate;
	/**失效日期*/
	@Excel(name = "失效日期", width = 15, format = "yyyy-MM-dd")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@ApiModelProperty(value = "失效日期")
	private Date expiryDate;
	/**消耗方式*/
	@Dict(dicCode = "mdm_consume_type")
	@Excel(name = "消耗方式", width = 15)
	@ApiModelProperty(value = "消耗方式")
	private String consumeType;
	/**组件数量*/
	@Excel(name = "组件数量", width = 15)
	@ApiModelProperty(value = "组件数量")
	private java.math.BigDecimal partQty;
	/**BOM总量*/
	@Excel(name = "BOM总量", width = 15)
	@ApiModelProperty(value = "BOM总量")
	private java.math.BigDecimal sumQty;
	/**损耗率*/
	@Excel(name = "损耗率", width = 15)
	@ApiModelProperty(value = "损耗率")
	private java.lang.String lossRate;
	/**项目文本*/
	@Excel(name = "项目文本", width = 15)
	@ApiModelProperty(value = "项目文本")
	private java.lang.String projectNote;
	/**仓储地点*/
	@Excel(name = "仓储地点", width = 15)
	@ApiModelProperty(value = "仓储地点")
	private java.lang.String storageLocation;
	/**用途*/
	@Excel(name = "用途", width = 15, dicCode = "mdm_use_type")
	@ApiModelProperty(value = "用途")
	private java.lang.String bomUseType;
	/**创建人*/
	@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
	@ApiModelProperty(value = "创建人")
	private String createBy;
	/**创建时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@ApiModelProperty(value = "创建时间")
	private Date createTime;
	/**修改人*/
	@ApiModelProperty(value = "修改人")
	private String updateBy;
	/**修改时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@ApiModelProperty(value = "修改时间")
	private Date updateTime;
	/**启用标志*/
	@Excel(name = "启用标志", width = 15)
	@ApiModelProperty(value = "启用标志")
	private String enableFlag;
	/**所属部门*/
	@ApiModelProperty(value = "所属部门")
	private String sysOrgCode;
	/**租户ID*/
	@Excel(name = "租户ID", width = 15)
	@ApiModelProperty(value = "租户ID")
	private Integer tenantId;

	private List<MdmBomTreePage> children = new ArrayList<>();

	public void setKeyAndTitle(){
		this.setKey(this.getId());
		this.setTitle(this.getMaterialDesc());
	}
}
